package edu.xmut.prototype.deepclone;

/**
 * @author 朔风
 * @date 2024-02-18 18:13
 */
public class Client {
    public static void main(String[] args) {
        DeepProtoType deepProtoType = new DeepProtoType("jack");
        deepProtoType.setDeepCloneableTarget(new DeepCloneableTarget("克隆", "克隆的类"));

        // 方式一：
        DeepProtoType p2 = deepProtoType.clone();
        System.out.println(deepProtoType + " DeepCloneableTarget=" + deepProtoType.getDeepCloneableTarget().hashCode());
        System.out.println(p2 + " DeepCloneableTarget=" + p2.getDeepCloneableTarget().hashCode());

        System.out.println("==========================================================");
        // 方式二：
        DeepProtoType p3 = deepProtoType.deepClone();
        System.out.println(deepProtoType + " DeepCloneableTarget=" + deepProtoType.getDeepCloneableTarget().hashCode());
        System.out.println(p3 + " DeepCloneableTarget=" + p3.getDeepCloneableTarget().hashCode());


    }
}
